Class {
	#name : 'RenrakuTest',
	#superclass : 'ReCodeBasedTestCase',
	#category : 'Renraku-Tests',
	#package : 'Renraku-Tests'
}

{ #category : 'tests' }
RenrakuTest >> testAsClassRuleTransformation [
	| asClassMethod critique |

	asClassMethod := testClass >> (testClass compile:
		'aMethodWhichSendsAsClass
			#', self class name, ' asClassIfAbsent: [ nil ]').

	critique := asClassMethod critiques detect: [ :crit |
		crit rule class = ReAsClassRule ].

	self assert: critique change class equals: ReAddMethodChange.
	self assert: (critique change source includesSubstring: 'self class environment at:')
]

{ #category : 'tests' }
RenrakuTest >> testBan [
	| criticToSkip |

	criticToSkip := testClass critiques detect: [ :critic |
		critic rule class = ScreamerRule ].

	testClass ban: criticToSkip.

	self assert: (testClass critiques noneSatisfy: [ :critic |
		critic rule class = ScreamerRule ])
]

{ #category : 'tests' }
RenrakuTest >> testBan1 [
	| criticToSkip |


	criticToSkip := testMethod critiques detect: [ :critic |
		critic rule class = ScreamerRule ].

	testMethod ban: criticToSkip.

	self assert: (testMethod critiques noneSatisfy: [ :critic |
		critic rule class = ScreamerRule ])
]

{ #category : 'tests' }
RenrakuTest >> testBan2 [
	| criticToSkip |


	criticToSkip := testMethod critiques detect: [ :critic |
		critic rule class = ScreamerRule ].

	testClass ban: criticToSkip.

	self assert: (testMethod critiques noneSatisfy: [ :critic |
		critic rule class = ScreamerRule ])
]

{ #category : 'tests' }
RenrakuTest >> testBanForPackage [
	| criticToSkip |

	criticToSkip := testClass critiques detect: [ :critic |
		critic rule class = ScreamerRule ].

	testPackage ban: criticToSkip.

	self assert: (testClass2 critiques noneSatisfy: [ :critic |
		critic rule class = ScreamerRule ])
]

{ #category : 'tests' }
RenrakuTest >> testNoClassComment [

	self assert: (testClass critiques anySatisfy: [ :critic |
		critic rule class = ReNoClassCommentRule ]).

	testClass comment: 'Now I have a comment'.

	self assert: (testClass critiques noneSatisfy: [ :critic |
		critic rule class = ReNoClassCommentRule ])
]

{ #category : 'tests' }
RenrakuTest >> testUnclassifiedMethod [

	self assert: (testMethod critiques anySatisfy: [ :critic |
		critic rule class = ReUnclassifiedMethodsRule ]).

	testMethod protocol: 'some protocol'.

	self assert: (testMethod critiques noneSatisfy: [ :critic |
		critic rule class = ReUnclassifiedMethodsRule ])
]
